]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
remoteSearch: support serialized GIcons
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 24 Apr 2013 16:05:22 +0000 (12:05 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 24 Apr 2013 19:54:31 +0000 (15:54 -0400)
Since [1], GIO supports generic serialization and deserialization of a
GIcon into a GVariant. This is also implemented by GdkPixbuf and could be
used instead of our homegrown code for it.

This commit adds support to another 'icon' key in the metas dictionary
returned by applications for it. The previous 'gicon' and 'icon-data'
keys are still parsed and supported as before, but are now deprecated.

[1]
https://git.gnome.org/browse/glib/commit/?id=c16f914b40c749b938490a4e10a3c54ec1855c42

https://bugzilla.gnome.org/show_bug.cgi?id=698761

configure.ac
data/org.gnome.ShellSearchProvider2.xml
js/ui/remoteSearch.js

index 1e390bb1c0b2a4e42b53ca79681f8830dd95da17..21ba3025fbe7e67556a8ea4108035d6b92f3363e 100644 (file)
@@ -65,7 +65,7 @@ GOBJECT_INTROSPECTION_MIN_VERSION=0.10.1
 GJS_MIN_VERSION=1.35.4
 MUTTER_MIN_VERSION=3.8.1
 GTK_MIN_VERSION=3.7.9
-GIO_MIN_VERSION=2.35.0
+GIO_MIN_VERSION=2.37.0
 LIBECAL_MIN_VERSION=3.5.3
 LIBEDATASERVER_MIN_VERSION=3.5.3
 TELEPATHY_GLIB_MIN_VERSION=0.17.5
index 7947d034600722a9d879f45b8bc357d4a2e552cd..9502340e4633e2885c9beaec31248161ee46000b 100644 (file)
@@ -46,7 +46,7 @@
     <!--
         GetResultMetas:
         @identifiers: An array of result identifiers as returned by GetInitialResultSet() or GetSubsearchResultSet()
-        @metas: A dictionary describing the given search result, containing a human-readable 'name' (string), along with the result identifier this meta is for, 'id' (string). Optionally, either 'gicon' (a serialized GIcon) or 'icon-data' (raw image data as (iiibiiay) - width, height, rowstride, has-alpha, bits per sample, channels, data) can be specified if the result can be better served with a thumbnail of the content (such as with images). A 'description' field (string) may also be specified if more context would help the user find the desired result.
+        @metas: A dictionary describing the given search result, containing a human-readable 'name' (string), along with the result identifier this meta is for, 'id' (string). Optionally, 'icon' (a serialized GIcon as obtained by g_icon_serialize) can be specified if the result can be better served with a thumbnail of the content (such as with images). 'gicon' (a serialized GIcon as obtained by g_icon_to_string) or 'icon-data' (raw image data as (iiibiiay) - width, height, rowstride, has-alpha, bits per sample, channels, data) are deprecated values that can also be used for that purpose. A 'description' field (string) may also be specified if more context would help the user find the desired result.
 
         Return an array of meta data used to display each given result
     -->
index e7cd6fea1c18a0c589cd205c8c0c822445b52b6f..3d0c759b85724ecae632f5192dfbede1388a69cc 100644 (file)
@@ -187,7 +187,9 @@ const RemoteSearchProvider = new Lang.Class({
 
     createIcon: function(size, meta) {
         let gicon;
-        if (meta['gicon']) {
+        if (meta['icon']) {
+            gicon = Gio.icon_deserialize(meta['icon']);
+        } else if (meta['gicon']) {
             gicon = Gio.icon_new_for_string(meta['gicon']);
         } else if (meta['icon-data']) {
             let [width, height, rowStride, hasAlpha,
@@ -240,8 +242,12 @@ const RemoteSearchProvider = new Lang.Class({
         let metas = results[0];
         let resultMetas = [];
         for (let i = 0; i < metas.length; i++) {
-            for (let prop in metas[i])
-                metas[i][prop] = metas[i][prop].deep_unpack();
+            for (let prop in metas[i]) {
+                // we can use the serialized icon variant directly
+                if (prop != 'icon')
+                    metas[i][prop] = metas[i][prop].deep_unpack();
+            }
+
             resultMetas.push({ id: metas[i]['id'],
                                name: metas[i]['name'],
                                description: metas[i]['description'],